Core.Action.Dom = function(struct, type) {
	this.struct = struct;
	this.attrs = new Core.Attrs.Dom(struct.properties, this)
	this.node = null;
	this.children = [];
	
	this._createNode(type);
	this._createContent();
};

Core.Action.Dom.prototype = {

	_createNode: function(type) {
		var node = this.node = document.createElement(type),
			map, attrs = this.attrs;
		
		map = attrs.get("attrs");
		for(var k in map) {
			node.setAttribute(k, map[k]);
		}
		
		map = attrs.get("styles");
		for(var k in map) {
			node.style[k] = map[k];
		}
		
		map = attrs.get("events");
		for(var k in map) {
			Event.attach(k, map[k], node, attrs);
		}
	},
	
	_createContent: function() {
		var structs = this.struct.content || [],
			len = structs.length;
		
		for(var i = 0; i < len; i++) {
			var action = new Core.Action.Dom(structs[i], "div")
			action.attach(this.node, null);
			
			this.children.push(action);
		}
	},
	
	attach: function(parent, before) {
		if(before) { parent.injectBefore(this.node, before); }
		else { parent.appendChild(this.node); }
	}
};
/*
Core.Action.Dom.AttrRoots = [
	{name: "attrs", evaluate: true}, 
	{name: "events", evaluate: false}, 
	{name: "styles", evaluate: true}
];
*/